#ifndef __SIPCLNINVITETRANS_HPP__
#define __SIPCLNINVITETRANS_HPP__

#include "SipResipConfigure.hpp"
#include "SipClnTransaction.hpp"

namespace wtsip{

//class CSipClnTransactionCallback;
class CSipClnTransaction;

class RESIP_PUBLIC CSipClnInviteTransCallback{
public:
    virtual bool onTrying(CSipClnTransaction& clntran, SipMessage& msg) = 0;

    virtual bool onCanceled(CSipClnTransaction& clntran, SipMessage& msg) = 0;

    virtual bool onFailed(CSipClnTransaction& clntran, SipMessage& msg) = 0;

    virtual bool onSuccessed(CSipClnTransaction& clntran, SipMessage& msg) = 0;

    virtual bool onStateChange(CSipClnTransaction& clntran, int newState) = 0;
};


class RESIP_PUBLIC CSipClnInviteTrans: public CSipClnTransaction
{
public:

    typedef enum{
        InvClnInitial = 4,
        InvClnInvite,
        InvClnTrying,
        InvClnCancel,
        InvClnCanceled,
        InvClnFailed,
        InvClnSuccessed
    } ESipClnTranState;
    
    CSipClnInviteTrans(SipMessage& request, CSipUserAgent& ua);

    virtual ~CSipClnInviteTrans();

    virtual bool send(std::auto_ptr<SipMessage> msg);

    virtual bool processIncoming(SipMessage* msg);

    bool registerInvCallback(CSipClnInviteTransCallback* callback);

    bool unregisterInvCallback();

    SipMessage* createFailAck();

    SipMessage* createCancel();

private:

    virtual bool setState(int state);

    //bool setState(ESipClnTranState s);

private:

    CSipClnInviteTransCallback* m_invCallback;
    
};




} // namespace
#endif


